<?php
/**
 * index.php
 * @author liuch
 * @version 1.0
 * @date 2017-07-27 16:42
 */

define('ROOT_PATH', realpath(__DIR__) . DIRECTORY_SEPARATOR);

require_once ROOT_PATH . 'Http.php';
require_once ROOT_PATH . 'Cookie.php';
require_once ROOT_PATH . 'Request.php';
require_once ROOT_PATH . 'common.php';
$http = new Http();
$request = new Request();
$cookieObj = new Cookie();


////自动登陆
//$params = array(
//    'userName' => 'MTg4NTA3MTczNTI=',
//    'userPwd' => 'bG1qMTk5MDMyMjUyNg==',
//);
//$loginData = $http->curlGet($request->getUrl('AutoLogin', $params), $cookieObj->getCookie());
//var_dump(json_decode($loginData, true));

////用户登录
//$params = array(
//    'userName' => 'MTg4NTA3MTczNTI=',
//    'userPwd' => 'bG1qMTk5MDMyMjUyNg==',
//    'securityCode' => '',
//);
//$userInfo = $http->curlGet($request->getUrl('Login', $params), $cookieObj->getCookie());
//var_dump(json_decode($userInfo, true));

////获取医生预约
//$params = array(
//    'deptCode' => 28,
//    'doctor' => '许金榜/2270',
//);
//$doctorSchedule = $http->curlGet($request->getUrl('GetScheduleDoctor', $params), $cookieObj->getCookie());
//var_dump(json_decode($doctorSchedule, true));
//
////获取用户信息
//$params = array();
//$userInfo = $http->curlGet($request->getUrl('GetUserInfo', $params), $cookieObj->getCookie());
//var_dump(json_decode($userInfo, true));
//
////获取门诊预约
//$params = array(
//    'deptCode' => '28',
//    'startTime' => '',
//    'endTime' => '',
//);
//$scheduleList = $http->curlGet($request->getUrl('GetScheduleList', $params), $cookieObj->getCookie());
//var_dump(json_decode($scheduleList, true));
//
////获取门诊信息
//$params = array();
//$deptList = $http->curlGet($request->getUrl('GetPrecontractDeptList', $params), $cookieObj->getCookie());
//var_dump(json_decode($deptList, true));
//
//获取用户预约信息列表
$params = array(
    'pageSize' => '15',
    'pageIndex' => '1',
);
$precontractList = $http->curlGet($request->getUrl('GetMyPrecontractList', $params), $cookieObj->getCookie());
echo $precontractList;
//$precontractList = json_decode($precontractList, true);
//$data = array_column($precontractList['data'], 'WorkDate');
//saveOrder($data);
//var_dump($precontractList);
exit();
////获取时间
//$params = array();
//$dayList = $http->curlGet($request->getUrl('GetDays', $params), $cookieObj->getCookie());
//var_dump(json_decode($dayList, true));
//
//用户预约
//$params = array(
//    'id' => '4110437',
//    'deptCode' => '28',
//    'deptName' => '中医科',
//    'doctor' => '许金榜/2270',
//    'time' => '2017-08-10 09:55:00',
//    'dateType' => '1',
//    'icCard' => 'A08363482',
//    'doctorName' => '许金榜',
//    'branch' => '',
//    'endTime' => '0001-01-01 00:00:00',
//);
//$doRes = $http->curlGet($request->getUrl('Do', $params), $cookieObj->getCookie());
//var_dump(json_decode($doRes, true));
